package com.htic.suricata.spreadsheet.model;

import java.io.IOException;

import com.htic.arq.core.util.StringUtils;
import com.htic.suricata.core.model.TestSourceException;
import com.htic.suricata.core.model.TestSourceProperties;
import com.htic.suricata.core.util.SuricataConstants;

public class TestSourceSpreadSheetProperties extends TestSourceProperties {

	private String spreadSheetFilePath;


	public TestSourceSpreadSheetProperties(String pathParamFile) throws IOException {
		super(pathParamFile);
	}


	@Override
	protected void checkRequiredParameters() {
		String propKey;
		String propValue;
		String appName	= StringUtils.removeChar(SuricataConstants.APP_NAME.toLowerCase(), ' ');
		String modName	= StringUtils.removeChar(SuricataConstants.MODULE_NAME.toLowerCase(), ' ');

		propKey		= appName.concat(".").concat(SuricataConstants.PROPNAME_TESTSOURCE).concat(".").concat(modName).concat(".").concat(SuricataConstants.PROPNAME_FILEPATH);
		propValue	= getProperty(propKey);

		if (propValue == null) {
			throw new TestSourceException(TestSourceException.MISSING_REQUIRED_PARAMETER);
		} else {
			this.setSpreadSheetFilePath(propValue);
		}
	}


	//Private Getters && Setters
	private void setSpreadSheetFilePath(String pathFile) {
		this.spreadSheetFilePath = pathFile;
	}

	//Getters && Setters
	public String getSpreadSheetFilePath() {
		return spreadSheetFilePath;
	}
}